import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:kq_flutter_core_widget/utils/kq_screen_util.dart';
import 'package:kq_flutter_widgets/resources/kq_images.dart';
import '../../resources/kq_theme_colors.dart';
import 'package:kq_flutter_core_widget/widgets/image/kq_image.dart';
import 'package:kq_flutter_widgets/widgets/seekbar/seek_bar.dart';

import '../../config/kq_global.dart';

class KqSeekBar extends StatelessWidget {
  /// seekbar的值的回调
  final void Function(int one, int two)? callback;

  /// 是否是双滑块，默认为否
  final bool isTwoSeekBar;

  /// 第一个seekbar位置
  final double? valueOneSeekBar;

  /// 第二个seekbar位置
  final double? valueTwoSeekBar;

  /// 进度条最大值
  final double max;

  ///背景进度颜色
  final Color bgColor;

  ///只有一个seekbar的进度颜色
  final Color oneSeekColor;

  ///有两个seekbar时第二个进度的颜色
  final Color twoSeekColor;

  const KqSeekBar({
    super.key,
    this.callback,
    this.isTwoSeekBar = false,
    this.valueOneSeekBar,
    this.valueTwoSeekBar,
    this.max = 100,
    this.bgColor = KqThemeColors.bgF5,
    this.oneSeekColor = KqThemeColors.textLightBlue,
    this.twoSeekColor = KqThemeColors.bgF5,
  });

  @override
  Widget build(BuildContext context) {
    return SeekBar(
      callback: (one, two) {
        callback?.call(one.toInt(), two.toInt());
      },
      isTwoSeekBar: isTwoSeekBar,
      valueOneSeekBar: valueOneSeekBar,
      valueTwoSeekBar: valueTwoSeekBar,
      max: max,
      bgColor: bgColor,
      oneSeekColor: oneSeekColor,
      twoSeekColor: twoSeekColor,
      oneSeekWidget: KqImage.assets(
        url: KqImages.commonIcHuakuai28,
        package: KqGlobal.packageName,
        width: 44.r,
        height: 44.r,
      ),
      twoSeekWidget: KqImage.assets(
        url: KqImages.commonIcHuakuai28,
        package: KqGlobal.packageName,
        width: 44.r,
        height: 44.r,
      ),
      height: 44.r,
      progressHeight: 4.r,
    );
  }
}
